package com.hdj.chapter5;

import java.io.IOException;

/**
 * @description
 * @auther hdj
 * @date 2017/12/12.
 */
public class PrototypeTest {

    public static void main(String[] args) throws CloneNotSupportedException, IOException, ClassNotFoundException {
        Address address = new Address();
        address.setCity("湖南");

        Student student1 = new Student();
        student1.setAge(18);
        student1.setName("张三");
        student1.setAddress(address);

        Student student3 = (Student)student1.deepClone();
        student3.setAge(20);
        student3.getAddress().setCity("河北");


        System.out.println(student1);
        System.out.println(student3);
    }
}
